package com.qf.usefull.stringbuffer;

import java.io.IOException;

public class Demo01 {
    public static void main(String[] args) throws IOException {

        // 如何把一个字符串进行反向输出
        String s = "hello world";

        StringBuffer stringBuffer = new StringBuffer(s);
        String s1 = stringBuffer.reverse().toString();
        System.out.println(s1);

//        char[] charArray = s.toCharArray();
//        for (int i = charArray.length-1; i>=0; i--) {
//            System.out.print(charArray[i]);
//        }
//        System.out.println();

//        Appendable stringBuffer = new StringBuffer();
//        stringBuffer.append('a');
//        stringBuffer.append("hello");
//        stringBuffer.append("hi");
//        stringBuffer.append("world");
//
//        System.out.println(stringBuffer);

//        StringBuffer stringBuffer1 = new StringBuffer();
//        System.out.println(stringBuffer1.capacity());
//        System.out.println(stringBuffer1.length());
//        stringBuffer1.append("hi");
//        System.out.println(stringBuffer1.capacity());
//        System.out.println(stringBuffer1.length());
//        stringBuffer1.append("world1111111111111111111");
//        System.out.println(stringBuffer1.capacity());
//        System.out.println(stringBuffer1.length());

    }
}
